﻿#pragma once

#include "discrete_face_utils.hxx"
/**
 * 此文件保存离散化环面的函数.
 */

class torus_faceter : abstract_faceter {
private:
    torus* tori = nullptr;
    void setupTorus(FACE* f) {
        tori = (torus*)&f->geometry()->equation();
    }

protected:
    int loop_edge_siz = 0;
    void init() override;
    void decideUVlen() override;
    bool getLoops() override;
    void peripheryProcess() override;
    bool USeperationProcess() override;
    bool VSeperationProcess() override;
    void holeProcess() override;
    void attachMesh() override;
    void decideUV(FACE* f, int& ulen, int& vlen, double nt, double st);
    void performTriangulationAndAttach();

public:
    torus_faceter(FACE* f, double nt = 0, double st = 0) : abstract_faceter(f, nt, st) {}
    outcome facet() override;
};

outcome facet_face_torus(FACE* f, double nt = 0, double st = 0);

void get_uvlen_torus(FACE* f, int& ulen, int& vlen, double nt = 0, double st = 0);
